<template>
  <swiper v-if="banners.length">
    <swiper-item v-for="(item, index) in banners">
      <a :href="item.link">
        <img :src="item.image" @load="imgLoad(index)">
      </a>
    </swiper-item>
  </swiper>
</template>

<script>
  import Swiper from 'components/common/swiper/Swiper'
  import SwiperItem from 'components/common/swiper/SwiperItem'

  export default {
    name: "SwiperView",
    components: {
      Swiper,
      SwiperItem
    },
    props: {
      banners: {
        type: Array,
        default() {
          return []
        }
      }
    },
    methods: {
      imgLoad(index) {
        if (index == this.banners.length-1) {
          this.$emit('swiperImgLoad')
        }
      }
    }

  }
</script>

<style scoped>

</style>
